package minimapbuttons;

import impsoft.scripting.types.ColorSkeltonScriptable;

import java.awt.Rectangle;

public enum MiniMapButton {
	LIFEPOINTS("Hitpoints Button", 0),
	SUMMONING("Summoning button", 0);

	public final static int masterIndice = 880;

	private String name;
	private int childIndice;

	MiniMapButton(String name, int childIndice) {
		this.name = name;
		this.childIndice = childIndice;
	}

	public Rectangle getLocation() {
		return null;
	}

	public String getName() {
		return name;
	}

	public int getChildIndice() {
		return childIndice;
	}

	public boolean doMiniMapButtonAction(MiniMapButtonOption option, ColorSkeltonScriptable cs)
			throws InterruptedException {
		Rectangle r = getMiniMapButtonArea();
		if (r != null) {
			cs.mouseMove(r);
			if (cs.theTopText.getTopText().contains(option.getTopText())) {
				cs.mouseClickLeft(cs.getCurrentMouseXY());
				return true;
			} else {
				cs.mouseClickRight(cs.getCurrentMouseXY());
				if (waitForMenu()) {
					return cs.theMenuFinder.doMenuContains(option.getTopText());
				}
			}
		}
		return false;
	}
}
